package com.lankystar.logistucs.spring.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="oneOrder")
public class OneOrder {

	private int oneOrderId;
	private String oneOrderNu;
	private long createTime;
	private int type;//便于查询、没有意义
	private Address address;
	private Company company;
	private List<Cargo> cargos;
	private List<OneOrderAndOneStatus> oao;
	private int remove;//0未删除、1删除
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public int getOneOrderId() {
		return oneOrderId;
	}
	public void setOneOrderId(int oneOrderId) {
		this.oneOrderId = oneOrderId;
	}
	public String getOneOrderNu() {
		return oneOrderNu;
	}
	public void setOneOrderNu(String oneOrderNu) {
		this.oneOrderNu = oneOrderNu;
	}
	public long getCreateTime() {
		return createTime;
	}
	public void setCreateTime(long createTime) {
		this.createTime = createTime;
	}
	@ManyToOne
	@JoinColumn(name="address_Id")
	public Address getAddress() {
		return address;
	}
	public void setAddress(Address address) {
		this.address = address;
	}
	@ManyToOne
	@JoinColumn(name="company_Id")
	public Company getCompany() {
		return company;
	}
	public void setCompany(Company company) {
		this.company = company;
	}
	public int getRemove() {
		return remove;
	}
	public void setRemove(int remove) {
		this.remove = remove;
	}
	@OneToMany(mappedBy="oneOrder",cascade=CascadeType.ALL,fetch =FetchType.EAGER)
	public List<Cargo> getCargos() {
		return cargos;
	}
	public void setCargos(List<Cargo> cargos) {
		this.cargos = cargos;
	}
	@OneToMany(mappedBy="oneOrder")
	public List<OneOrderAndOneStatus> getOao() {
		return oao;
	}
	public void setOao(List<OneOrderAndOneStatus> oao) {
		this.oao = oao;
	}
	public int getType() {
		return type;
	}
	public void setType(int type) {
		this.type = type;
	}
	
	
}
